package com.jt9003.service.impl;

import com.jt9003.dao.ConfirmReceiptMapper;
import com.jt9003.pojo.Drugs;
import com.jt9003.pojo.Warehouse;
import com.jt9003.service.ConfimReceiptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class ConfimReceiptServiceImpl implements ConfimReceiptService {

    @Resource
    private ConfirmReceiptMapper confirmReceiptMapper;
    @Override
    //分页显示,模糊查询根据药品类型和单据号查询未确认入库的入库单
    public List<Warehouse> getWarehouseList(Map map) {
        return confirmReceiptMapper.getWarehouse(map);
    }

    //查询未入库的单据的总数
    public Integer warCount(Map param){
        return confirmReceiptMapper.warCount(param);
    }

    @Override
    //根据单据号删除入库单据
    public int deleteWar(String documentNo) {
        return confirmReceiptMapper.deleteWar(documentNo);
    }

    @Override
    //根据单据号删除入库单据对应的药品信息
    public int deleteDrugs(String documentNo) {
        return confirmReceiptMapper.deleteDrugs(documentNo);
    }

    @Override
    //修改入库单页面 入库单信息
    public int updateWarehouse(Warehouse warehouse) {
        return confirmReceiptMapper.updateWarehouse2(warehouse);
    }

    @Override
    //修改入库单页面 药品信息
    public int updateDrugs(Drugs drugs) {
        return confirmReceiptMapper.updateDrugs(drugs);
    }

    @Override
    /*确认入库单页面
     *点击修改或者查看详情时，根据单据id连表查询入库单和药品信息
     * */
    public Warehouse selectWarAndDrugs(String documentNo) {
        return confirmReceiptMapper.selectWarAndDrugs(documentNo);
    }

    @Override
    //确认入库单页面，确认入库，修改入库状态
    public int updateWarStrtus(String documentNo) {
        return confirmReceiptMapper.updateWarStatus(documentNo);
    }


}
